CentOS 7
Sponsored Link

OpenStack Newton : How to use Manila#1
2016/10/31
 
This is How to use OpenStack Shared File System (Manila).
This example shows to install Manila on the existing environment like follows.
For example, Configure local block device as shared storage on Storage Node and use it from Instances.
Therefore, it needs there is a free block device on Storage Node.
                                    |
+----------------------+            |            +-----------------------+
|   [ Control Node ]   |            |            |   [ Storage Node ]    |
|       Keystone       |10.0.0.30   |   10.0.0.50|       DHCP Agent      |
|        Glance        |------------+------------|       L3 Agent        |
|       Nova API       |eth0        |        eth0|       L2 Agent        |
|    Neutron Server    |            |            |    Metadata Agent     |
|      Manila API      |            |            |     Manila Share      |
|                      |            |            |                       |
+----------------------+            |            +-----------------------+
                                eth0|10.0.0.51
                        +----------------------+
                        |   [ Compute Node ]   |
                        |     Nova Compute     |
                        |       L2 Agent       |
                        +----------------------+

[1] Configure Storage Node.
[root@storage ~]#
yum -y install nfs-utils nfs4-acl-tools
# create a volume for Manila on free block device

[root@storage ~]#
pvcreate /dev/sdb1

  Physical volume "/dev/sdb1" successfully created
[root@storage ~]#
vgcreate manila-volumes /dev/sdb1

  Volume group "manila-volumes" successfully created
[root@storage ~]#
vi /etc/manila/manila.conf
# add follows into [DEFAULT] section

enabled_share_backends = lvm
# add to the end

[lvm]
share_backend_name = LVM
share_driver = manila.share.drivers.lvm.LVMShareDriver
driver_handles_share_servers = False
lvm_share_volume_group = manila-volumes
lvm_share_export_ip = 10.0.0.50
[root@storage ~]#
systemctl start openstack-manila-share nfs-server

[root@storage ~]#
systemctl enable openstack-manila-share nfs-server
# the name of NFS service for Systemd which is controled by Manila is Debian related name and some errors occur, so create a link like follows

[root@storage ~]#
cd /usr/lib/systemd/system

[root@storage system]#
ln -s nfs-server.service nfs-kernel-server.service
[2] Create default share type. It's OK to work on any node. (This example is on Control Node)
[root@dlp ~(keystone)]#
manila type-create default_share_type False

+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| required_extra_specs | driver_handles_share_servers : False |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | -                                    |
| ID                   | 65242673-22e0-4519-9b5a-84c8f7c5a88d |
| optional_extra_specs | snapshot_support : True              |
+----------------------+--------------------------------------+

[root@dlp ~(keystone)]#
manila type-list

+--------+--------------------+------------+------------+--------------------------------------+-------------------------+
| ID     | Name               | visibility | is_default | required_extra_specs                 | optional_extra_specs    |
+--------+--------------------+------------+------------+--------------------------------------+-------------------------+
| 652... | default_share_type | public     | YES        | driver_handles_share_servers : False | snapshot_support : True |
+--------+--------------------+------------+------------+--------------------------------------+-------------------------+
[3] Create NFS share.
[root@dlp ~(keystone)]#
manila create NFS 1 --name share01

+-----------------------------+--------------------------------------+
| Property                    | Value                                |
+-----------------------------+--------------------------------------+
| status                      | creating                             |
| share_type_name             | default_share_type                   |
| description                 | None                                 |
| availability_zone           | None                                 |
| share_network_id            | None                                 |
| share_server_id             | None                                 |
| host                        |                                      |
| access_rules_status         | active                               |
| snapshot_id                 | None                                 |
| is_public                   | False                                |
| task_state                  | None                                 |
| snapshot_support            | True                                 |
| id                          | 6a1ff1a2-a1ae-4fba-a129-d76c31bf9562 |
| size                        | 1                                    |
| user_id                     | 0a28ee66b05f4c7b9709f316c5109e0a     |
| name                        | share01                              |
| share_type                  | 65242673-22e0-4519-9b5a-84c8f7c5a88d |
| has_replicas                | False                                |
| replication_type            | None                                 |
| created_at                  | 2016-10-31T02:25:49.000000           |
| share_proto                 | NFS                                  |
| consistency_group_id        | None                                 |
| source_cgsnapshot_member_id | None                                 |
| project_id                  | 150e205a8791426e8028a94699fb8848     |
| metadata                    | {}                                   |
+-----------------------------+--------------------------------------+

# few minutes later, the Status turns to available

[root@dlp ~(keystone)]#
manila list

+----------+---------+------+-------------+-----------+-----------+--------------------+-------------------------+-------+
| ID       | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host                    | Avail |
+----------+---------+------+-------------+-----------+-----------+--------------------+-------------------------+-------+
| 6a1ff... | share01 | 1    | NFS         | available | False     | default_share_type | network.srv.world@lvm.. | nova  |
+----------+---------+------+-------------+-----------+-----------+--------------------+-------------------------+-------+
[4] It's OK all, you can use Manila Shared filesystem from Instances like follows.
[root@dlp ~(keystone)]#
openstack server list

+-----------+----------+---------+------------------------------------+------------+
| ID        | Name     | Status  | Networks                           | Image Name |
+-----------+----------+---------+------------------------------------+------------+
| e5a31503- | CentOS_7 | SHUTOFF | int_net=192.168.100.11, 10.0.0.200 | CentOS7    |
+-----------+----------+---------+------------------------------------+------------+

# allow access rights first

[root@dlp ~(keystone)]#
manila access-allow share01 ip 10.0.0.0/24 --access-level rw

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| access_key   | None                                 |
| share_id     | 6a1ff1a2-a1ae-4fba-a129-d76c31bf9562 |
| access_type  | ip                                   |
| access_to    | 10.0.0.0/24                          |
| access_level | rw                                   |
| state        | new                                  |
| id           | b93ecc8f-6141-44eb-b46e-3569c0315da7 |
+--------------+--------------------------------------+

# it's no ploblem if State turns to active

[root@dlp ~(keystone)]#
manila access-list share01

+--------------------------------------+-------------+-------------+--------------+--------+------------+
| id                                   | access_type | access_to   | access_level | state  | access_key |
+--------------------------------------+-------------+-------------+--------------+--------+------------+
| b93ecc8f-6141-44eb-b46e-3569c0315da7 | ip          | 10.0.0.0/24 | rw           | active | None       |
+--------------------------------------+-------------+-------------+--------------+--------+------------+

[root@dlp ~(keystone)]#
openstack server start CentOS_7

# confirm access Path

[root@dlp ~(keystone)]#
manila show share01 | grep path | cut -d'|' -f3

path = 10.0.0.50:/var/lib/manila/mnt/share-191da0b5-69c6-4ae4-a325-9861ebaf1cf0
[root@dlp ~(keystone)]#
ssh 10.0.0.200

root@10.0.0.200's password:
Last login: Tue Oct 25 17:10:57 2016 from dlp.srv.world
# mount Manila shared storage

[root@host-192-168-100-11 ~]#
mount -t nfs 10.0.0.50:/var/lib/manila/mnt/share-191da0b5-69c6-4ae4-a325-9861ebaf1cf0 /mnt

[root@host-192-168-100-11 ~]#
df -hT

Filesystem                                                               Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root                                                  xfs       8.5G  949M  7.6G  11% /
devtmpfs                                                                 devtmpfs  991M     0  991M   0% /dev
tmpfs                                                                    tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                                                                    tmpfs    1001M  8.3M  993M   1% /run
tmpfs                                                                    tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1                                                                xfs       497M  107M  390M  22% /boot
tmpfs                                                                    tmpfs     201M     0  201M   0% /run/user/0
10.0.0.50:/var/lib/manila/mnt/share-191da0b5-69c6-4ae4-a325-9861ebaf1cf0 nfs4      976M  2.5M  907M   1% /mnt
 
Tweet